Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User guide: use docsy as module (in workspace) #1731

Closed
wants to merge 2 commits into from

Conversation

deining
Copy link
Collaborator

@deining deining commented Nov 12, 2023

After having #1217 merged, the user guide cannot built successfully using hugo --themesDir ../.. any more. This PR fixes this by pulling in docsy as a hugo module when building or previewing the user guide. In the module definition inside userguide/hugo.yaml, there is a workspace definition in place so that docsy is pulled in from the local docsy sources in the repo root level). Previewing the user guide is now as easy as:

cd userguide
hugo server

@deining deining added user guide Improvements to user guide CI/infra CI & infrastructure module labels Nov 12, 2023
@deining deining requested a review from chalin November 12, 2023 17:32
@deining deining mentioned this pull request Nov 12, 2023
6 tasks
Copy link
Collaborator

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But our CI / Netlify build actions use hugo --themesDir ../.. and the build process is running fine. E.g., this is the latest production build, https://app.netlify.com/sites/docsydocs/deploys/655157197e81260008cee338:

...
5:52:39 PM: > build:production
5:52:39 PM: > npm run _hugo -- --minify
5:52:40 PM: > _hugo
5:52:40 PM: > hugo --cleanDestinationDir --themesDir ../.. --minify
5:52:40 PM: Start building sites …
5:52:40 PM: hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended linux/amd64 BuildDate=2023-11-08T11:18:07Z VendorInfo=gohugoio
5:52:42 PM:                    | EN
5:52:42 PM: -------------------+-----
5:52:42 PM:   Pages            | 81
5:52:42 PM:   Paginator pages  |  0
5:52:42 PM:   Non-page files   |  8
5:52:42 PM:   Static files     | 35
5:52:42 PM:   Processed images |  5
5:52:42 PM:   Aliases          |  3
5:52:42 PM:   Sitemaps         |  1
5:52:42 PM:   Cleaned          |  0
5:52:42 PM: Total in 1767 ms
5:52:42 PM: > postbuild:production
5:52:42 PM: > npm run _check:links
...

The build works locally as well for me. Is there something I'm missing?

@deining
Copy link
Collaborator Author

deining commented Nov 13, 2023

The build works locally as well for me.

Yes, but only if you are using npm for the build. Then two directories will be created prior to build process via this directive:

"_mkdir:hugo-mod": "npx mkdirp ../github.com/FortAwesome/Font-Awesome ../github.com/twbs/bootstrap",

How to repoduce the error I'm referring to:

Run hugo server directly inside the folder userguide of the repo (that's what I'm regularly doing) and you are in trouble:

git clone https://github.com/google/docsy.git
cd userguide/
hugo server
...
Error: command error: failed to load modules: module "docsy" not found in "/home/andreas/docsy/userguide/themes/docsy"; either add it as a Hugo Module or store it in "/home/andreas/docsy/userguide/themes".: module does not exist

@deining
Copy link
Collaborator Author

deining commented Nov 13, 2023

After some tweaking, the user guide can be now build successfully via:

  • npm (netlify)
  • npm run serve (local)
  • hugo server (local)

@deining
Copy link
Collaborator Author

deining commented Nov 13, 2023

Just realized that with this PR in place, we can simplify package.json a bit. Done in second commit 31aeeb3.

Copy link
Collaborator

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for exploring this, but this PR breaks the builds of projects that don't use Docsy as a Hugo module because of the removal of the _mkdir:hugo-mod script.


As for switching to Hugo modules for the User Guide, the PSC decided against that in February of this year, back when Docsy support for Hugo modules was introduced. For some context, see the thread starting at @LisaFC's comment #871 (comment).

Part of the reasoning was that the Docsy example would use Hugo modules and the UG would not. With such a setup we have CI of two repos each testing out alternative Docsy usage scenarios.

I can bring up the issue again at the next PSC meeting if you'd like, but the reasons for doing it the way it is now still hold.

/cc @geriom @emckean

@chalin
Copy link
Collaborator

chalin commented Nov 16, 2023

As for switching to Hugo modules for the User Guide, the PSC decided against that in February of this year, back when Docsy support for Hugo modules was introduced. For some context, see the thread starting at @LisaFC's comment #871 (comment).

The PSC during today's meeting upheld the preference to not have the User Guide as a module. /cc @LisaFC @emckean @geriom. Closing.

@chalin chalin closed this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/infra CI & infrastructure module user guide Improvements to user guide
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants